<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>{$meta_title}-狂雨小说CMS</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
        <link rel="stylesheet" href="__ADMIN__/css/admin.css">
        <link rel="stylesheet" href="__ADMIN__/css/font.css">
    </head>
    <body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header layuiadmin-card-header-auto">
                        <div class="layui-form">
                            <div class="layui-inline">
                                <label class="layui-form-label">栏目</label>
                                <div class="layui-input-block">
                                    <select name="category" lay-filter="category">
                                        <option value="{:url('index')}">所有栏目</option>
                                        {volist name="category" id="vo"}
                                            <option value="{:url('index',['category'=>$vo['id']])}" {eq name="Request.param.category" value="$vo['id']"}selected="selected"{/eq}>{$vo.html}{$vo.title}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">推荐</label>
                                <div class="layui-input-block">
                                    <select name="position" lay-filter="category">
                                        <option value="{:url('index')}">全部</option>
                                        {volist name="Think.config.web.document_position" id="pos"}
                                            <option value="{:url('index',['position'=>$key])}" {if check_document_position($Request.param.position,$key)}selected="selected"{/if}>{$pos}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">连载</label>
                                <div class="layui-input-block">
                                    <select name="position" lay-filter="category">
                                        <option value="{:url('index')}">全部</option>
                                            <option value="{:url('index',['serialize'=>0])}" {eq name="Request.param.serialize" value="0"}selected="selected"{/eq}>连载</option>
                                            <option value="{:url('index',['serialize'=>1])}" {eq name="Request.param.serialize" value="1"}selected="selected"{/eq}>完结</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">排序</label>
                                <div class="layui-input-block">
                                    <select name="position" lay-filter="category">
                                        <option value="{:url('index')}">全部</option>
                                            <option value="{:url('index',['order'=>'update_time desc'])}" {eq name="Request.param.order" value="update_time+desc"}selected="selected"{/eq}>更新时间</option>
                                            <option value="{:url('index',['order'=>'id desc'])}" {eq name="Request.param.order" value="id+desc"}selected="selected"{/eq}>编号</option>
                                            <option value="{:url('index',['order'=>'hits desc'])}" {eq name="Request.param.order" value="hits+desc"}selected="selected"{/eq}>总人气</option>
                                            <option value="{:url('index',['order'=>'hits_month desc'])}" {eq name="Request.param.order" value="hits_month+desc"}selected="selected"{/eq}>月人气</option>
                                            <option value="{:url('index',['order'=>'hits_week desc'])}" {eq name="Request.param.order" value="hits_week+desc"}selected="selected"{/eq}>周人气</option>
                                            <option value="{:url('index',['order'=>'hits_day desc'])}" {eq name="Request.param.order" value="hits_day+desc"}selected="selected"{/eq}>日人气</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">状态</label>
                                <div class="layui-input-block">
                                    <select name="position" lay-filter="category">
                                        <option value="{:url('index')}">全部</option>
                                            <option value="{:url('index',['status'=>1])}" {eq name="Request.param.status" value="1"}selected="selected"{/eq}>正常</option>
                                            <option value="{:url('index',['status'=>0])}" {eq name="Request.param.status" value="0"}selected="selected"{/eq}>锁定</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <form method="post" action="{:url('')}">
                                <label class="layui-form-label">查询</label>
                                <div class="layui-input-inline w300">
                                    <div class="input-group">
                                        <input type="text" style="width:240px;" name="keywords" placeholder="请输入" class="layui-input" lay-verify="required" lay-verType="tips">
                                        <button class="layui-btn layuiadmin-btn-admin" lay-submit><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i></button>
                                    </div>
                                </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body">
                        <form class="layui-form" action="{:url('del')}">
                            <div style="padding-bottom: 10px;">
                                <button class="layui-btn layui-btn-danger" lay-submit lay-filter="del" type="submit"><i class="layui-icon layui-icon-delete"></i> 删除</button>
                                <button class="layui-btn" type="button" onclick="admin_show('添加','{:url('add')}',0,0,1)"><i class="layui-icon layui-icon-add-1"></i> 添加</button>
                                <button class="layui-btn layui-btn-normal" type="button" open-select open-title="修改栏目" open-url="{:url('category')}" open-width="400" open-height="150"><i class="layui-icon layui-icon-more"></i> 栏目</button>
                            </div>
                            <table class="layui-table">
                                <colgroup>
                                    <col width="50">
                                    <col width="80">
                                    <col>
                                    <col width="150">
                                    <col width="80">
                                    <col width="150">
                                    <col width="100">
                                    <col width="400">
                                </colgroup>
                                <thead>
                                    <tr>
                                        <th><input name="layTableCheckbox" lay-filter="layTableAllChoose" type="checkbox" lay-skin="primary"></th>
                                        <th>id</th>
                                        <th>名称</th>
                                        <th>栏目</th>
                                        <th>连载</th>
                                        <th>更新时间</th>
                                        <th>状态</th>
                                        <th><div align="center">操作</div></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {notempty name="list"}
                                    {volist name="list" id="vo"}
                                    <tr>
                                        <td><input name="id[]" type="checkbox" lay-skin="primary" value="{$vo.id}"></td>
                                        <td>{$vo.id}</td>
                                        <td>
                                            {$vo.title} 
                                            <span class="pl-20">
                                            {volist name="Think.config.web.document_position" id="pos"}
                                                {if check_document_position($vo['position'],$key)}
                                                {switch name="key"}
                                                    {case value="1"}<span class="layui-badge layui-bg-cyan">列推</span>{/case}
                                                    {case value="2"}<span class="layui-badge layui-bg-orange">频推</span>{/case}
                                                    {case value="4"}<span class="layui-badge">首推</span>{/case}
                                                {/switch}
                                                {/if}
                                            {/volist}
                                                {if $vo['create_time']>strtotime('-3month')}
                                                <span class="layui-badge layui-bg-blue">新书</span>
                                                {/if}
                                            </span>
                                        </td>
                                        <td>{$vo.category_text}</td>
                                        <td>{$vo.serialize_text}</td>
                                        <td>{$vo.update_time|time_format="Y-m-d H:i"}</td>
                                        <td><input type="checkbox" name="status" value="{$vo.status}" lay-skin="switch" lay-text="正常|禁用" lay-filter="status" lay-url="{:url('status',['id'=>$vo['id']])}" {eq name="vo.status" value="1"}checked{/eq}></td>
                                        <td align="center">
                                            <a onclick="admin_show('推荐','{:url('position',['id'=>$vo['id']])}',379,118,0,1)" class="layui-btn layui-bg-cyan layui-btn-xs" href="javascript:;"><i class="layui-icon layui-icon-star"></i>推荐</a>
                                            <a onclick="admin_show('编辑','{:url('edit',['id'=>$vo['id']])}',0,0,1)" class="layui-btn layui-btn-normal layui-btn-xs" href="javascript:;"><i class="layui-icon layui-icon-edit"></i>编辑</a>
                                            <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="admin_del(this,'{:url('del',['id'=>$vo['id']])}')"><i class="layui-icon layui-icon-delete"></i>删除</a>
                                            <a onclick="admin_show('管理章节','{:url('NovelChapter/index',['id'=>$vo['id']])}',0,0,1)" class="layui-btn layui-btn-xs" href="javascript:;"><i class="layui-icon layui-icon-add-1"></i>管理章节</a>
                                            <a onclick="admin_show('管理评论','{:url('Comment/index',['type'=>'novel','id'=>$vo['id']])}',800,600)" class="layui-btn layui-btn-warm layui-btn-xs" href="javascript:;"><i class="layui-icon layui-icon-reply-fill"></i>评论</a> {notempty name="vo['comment_count']"}<span class="layui-badge">{$vo['comment_count']}</span>{/notempty}
                                        </td>
                                    </tr>
                                    {/volist}
                                    {else/}
                                        <td colspan="8"> aOh! 暂时还没有内容! </td>
                                    {/notempty}
                                </tbody>
                            </table>
                            <div class="page">
                                {$list->appends("keywords",Request::param("keywords"))|raw}
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="__STATIC__/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/admin.js"></script>
    <script type="text/javascript">
        layui.use('form', function(){
            var form = layui.form;
            form.on('select(category)', function(data){
               window.location.href = data.value;
            });
        });
    </script>
    </body>
</html>